<extend name="Public/base"/>

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>{$meta_title}</h2>
	</div>
	<form id="form" action="__SELF__" method="post" class="form-horizontal">
		<div class="form-item cf">
			<label class="item-label">报送文件标题<span class="check-tips">(分发文件时显示的标题)</span></label>
			<div class="controls">
				<input type="text" class="text input-medium" name="title" value="">
			</div>
		</div>
		<div class="form-item">
            <label class="item-label">文件类别<span class="check-tips">（报送文件的分类）</span></label>
            <div class="controls">
                <select name="category">
                	<option value="0">请选择...</option>
                    <volist name="category" id="vo">
						<option value="{$vo.id}">{$vo.title}</option>
                    </volist>
                </select>
            </div>
        </div>
		<div class="form-item cf">
			<label class="item-label">选择上传文件<span class="check-tips">(选择一个要上传的文件,文件大小2M以内,允许文件格式为 {:C('DOWNLOAD_UPLOAD.exts')})</span></label>
			<div class="controls">
				<input type="file" id="upload_file">
				<input type="hidden" name="file_id" value=""/>
				<div class="upload-img-box"></div>
			</div>
		</div>
		<div class="form-item">
			<div class="controls edit_sort_btn">
				<button class="btn submit-btn ajax-post" target-form="form-horizontal" type="submit">确 定</button>
				<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
	<script type="text/javascript">
		//上传图片
	    /* 初始化上传插件 */
		$("#upload_file").uploadify({
	        "height"          : 30,
	        "swf"             : "__STATIC__/uploadify/uploadify.swf",
	        "fileObjName"     : "download",
	        "buttonText"      : "上传文件",
	        "uploader"        : "{:U('File/upload',array('session_id'=>session_id()))}",
	        "width"           : 120,
	        'removeTimeout'	  : 1,
	        'fileSizeLimit'   : 2048,
	        "onUploadSuccess" : uploadFile
	    });
		function uploadFile(file, data){
			var data = $.parseJSON(data);
	        if(data.status){
	        	$("input[name='file_id']").val(data.data);
	        	$("input[name='file_id']").parent().find('.upload-img-box').html(
	        		"<div class=\"upload-pre-file\"><span class=\"upload_icon_all\"></span>" + data.info + "</div>"
	        	);
	        } else {
	        	updateAlert(data.info);
	        	setTimeout(function(){
	                $('#top-alert').find('button').click();
	                $(that).removeClass('disabled').prop('disabled',false);
	            },1500);
	        }
	    }
	</script>
</block>

<block name="script">
<script type="text/javascript">
	highlight_subnav('{:U('Cabinet/index')}');
</script>
</block>